home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import logging
- from checkbox.test import FAIL, PASS, SKIP
- from checkbox.properties import Path
- from checkbox.plugin import Plugin
-
- class SubunitReport(Plugin):
- filename = Path(default = '%(checkbox_data)s/subunit.log')
- result_status_table = {
- FAIL: 'failure',
- PASS: 'success',
- SKIP: 'skip' }
-
- def register(self, manager):
- super(SubunitReport, self).register(manager)
- self._file = None
- for rt, rh in [
- ('gather', self.gather),
- ('report-result', self.report_result)]:
- self._manager.reactor.call_on(rt, rh)
-
-
-
- def gather(self):
- logging.debug('Opening filename: %s', self.filename)
- self._file = open(self.filename, 'w')
-
-
- def report_result(self, result):
- test = result.test
- name = '%s %s' % (test.suite, test.name)
- self._file.write('test: %s\n' % name)
- tags = []
- if tags:
- self._file.write('tags: %s\n' % ' '.join(tags))
-
- status = self.result_status_table[result.status]
- self._file.write('%s: %s' % (status, name))
- if result.data:
- data = result.data.replace('\n', '\n ').strip()
- self._file.write(' [\n %s\n]\n' % data)
- else:
- self._file.write('\n')
-
-
- factory = SubunitReport
-